#!/usr/bin/env python

import os
import re
import pickle

from os import path
from glob import iglob as glob


def main():
    exp = re.compile('^\d+')
    names = glob('*')
    results_file = 'results.pickle'
    results = pickle.load(open(results_file, 'rb'))
    c = 0
    for x in names:
        get = re.match(exp, x)
        if not get:
            continue
        num = str(int(get.group(0)))
        if num in results:
            os.rename(x, 'featured\\'+x)
            c += 1
    print c


if __name__ == '__main__':
    main()
